package com.itheima.HomeWork.Demo07;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.function.BiConsumer;

public class Student {
    private String name;
    private int score;

    public Student() {
    }

    public Student(String name, int score) {
        this.name = name;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }
}
class test{
    public static void main(String[] args) {
        //一班
        HashMap<Integer, Student> BanJi1 = new HashMap<>();

        BanJi1.put(1,new Student("张三",100));
        BanJi1.put(2,new Student("李四",10));
        BanJi1.put(3,new Student("王五",99));
        BanJi1.put(4,new Student("马六",98));
        BanJi1.put(5,new Student("杨七",97));
        //二班

        HashMap<Integer,Student> BanJi2= new HashMap<>();
        BanJi2.put(1,new Student("小张三",100));
        BanJi2.put(2,new Student("小李四",100));
        BanJi2.put(3,new Student("小王五",100));
        BanJi2.put(4,new Student("小马六",100));
        BanJi2.put(5,new Student("小杨七",100));

        //1年级
        List<HashMap<Integer,Student>> NianJi1=new ArrayList<>();
        Collections.addAll(NianJi1,BanJi1,BanJi2);

        //2年级
        List<HashMap<Integer,Student>> NianJi2=new ArrayList<>();
        Collections.addAll(NianJi2,BanJi1,BanJi2);


        int index=1;
        for(HashMap<Integer,Student> Banji:NianJi1){
            System.out.println("一年级的班级有："+index+"班");
            Banji.forEach(new BiConsumer<Integer, Student>() {
                @Override
                public void accept(Integer integer, Student student) {
                    System.out.println("学号"+integer+"姓名"+student.getName()+"分数"+student.getScore());
                }
            });
            index++;
        }
        index=1;
        for(HashMap<Integer,Student> Banji:NianJi2){
            System.out.println("二年级的班级有："+index+"班");
            Banji.forEach(new BiConsumer<Integer, Student>() {
                @Override
                public void accept(Integer integer, Student student) {
                    System.out.println("学号"+integer+"姓名"+student.getName()+"分数"+student.getScore());
                }
            });
            index++;
        }

    }
}
